package com.wuhunyu.controller;


import com.wuhunyu.commonutils.result.CommonResult;
import com.wuhunyu.entities.EduComment;
import com.wuhunyu.query.EduCommentQuery;
import com.wuhunyu.service.EduCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 评论 前端控制器
 *
 * @author wuhunyu
 * @since 2021-01-25
 */
@RestController
@RequestMapping("/eduComment")
//@CrossOrigin
public class EduCommentController {

    @Autowired
    private EduCommentService eduCommentService;

    @PostMapping("/selectAllComments")
    public CommonResult selectAllComments(@RequestBody EduCommentQuery eduCommentQuery) {
        return eduCommentService.selectAllComments(eduCommentQuery);
    }

    @PostMapping("/addComment")
    public CommonResult addComment(@RequestBody(required = false) EduComment eduComment, HttpServletRequest request) {
        return eduCommentService.addComment(eduComment, request);
    }

}

